﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Management/Management.master" AutoEventWireup="true"
    CodeFile="UserGroup.aspx.cs" Inherits="Admin_UserGroup" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table>
        <tr>
            <td style="vertical-align:top;">
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
                    ForeColor="#333333" GridLines="None" 
                    AllowPaging="True" PageSize="8">
                    <RowStyle BackColor="#EFF3FB" />
                    <Columns>
                        <asp:TemplateField HeaderText="用户组" SortExpression="Name">
                            <ItemTemplate>
                                <b>
                                    <%# Eval("Name") %></b><br />
                                登录后去向：<%# Eval("HomePage") %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="成员" SortExpression="Public">
                            <ItemTemplate>
                                <%# Eval("NumberOfUser") %> 人
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="是否公开注册" SortExpression="Public">
                            <ItemTemplate>
                                <%# Eval("Public").ToString().ToLower()=="true"?"是":"不是" %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="操作" ShowHeader="False">
                            <ItemTemplate>
                                <asp:Button ID="btn_AddRemoveUser" runat="server" CommandArgument='<%# Eval("ID") %>'
                                    OnClick="btn_AddRemoveUser_Click" Text="添加/移除用户" /><br />
                                <asp:Button ID="btn_DUpdate" runat="server" CommandArgument='<%# Eval("ID") %>' OnClick="btn_DUpdate_Click"
                                    Text="编辑" />
                                <asp:Button ID="btn_DDelete" runat="server" Text="删除" OnClick="btn_DDelete_Click"
                                    CommandArgument='<%# Eval("ID") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#2461BF" />
                    <AlternatingRowStyle BackColor="White" />
                </asp:GridView>
                <asp:Label ID="lbl_Error" runat="server" EnableViewState="False" ForeColor="Red"></asp:Label>
                <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="AvatarDAL.AvatarDataContext"
                    Select="new (ID, Name, HomePage, Public, NumberOfUser)" TableName="Avatar_Group">
                </asp:LinqDataSource>
            </td>
            <td style="vertical-align: top;">
                <asp:Button ID="btn_AddPanel" runat="server" Text="添加内容" 
                    onclick="btn_AddPanel_Click" />
                <asp:Panel ID="PanelAdd" runat="server">
                    <div class="Dialog">
                    <div class="Title">
                        添加</div>
                    <div class="Content">
                        用户组名称：<asp:TextBox ID="txt_NameAdd" runat="server" MaxLength="10"></asp:TextBox>&nbsp;
                        <br />
                        登录后去向：<asp:TextBox ID="txt_HomePageAdd" runat="server" MaxLength="150"></asp:TextBox>
                        <br />
                        是否公共注册：<asp:RadioButtonList ID="drp_PublicAdd" runat="server" RepeatDirection="Horizontal">
                            <asp:ListItem Value="true">是</asp:ListItem>
                            <asp:ListItem Value="false" Selected="True">不是</asp:ListItem>
                        </asp:RadioButtonList>
                        <asp:Button ID="btn_AddSubmit" runat="server" Text="添加" OnClick="btn_DAddSubmit_Click"
                            CssClass="Button" />
                            &nbsp;<asp:Button ID="Button3" runat="server" OnClick="btn_Cancel_Click"
                                Text="取消" CssClass="Button" />
                        <br />
                        <asp:Label ID="lbl_AddError" runat="server" ForeColor="Red" EnableViewState="False"></asp:Label>
                    </div>
                </div>
                </asp:Panel>
                <asp:Panel ID="PanelEdit" runat="server">
                    <div class="Dialog">
                        <div class="Title">
                            编辑</div>
                        <div class="Content">
                            用户组名称：<asp:TextBox ID="txt_NameUpdate" runat="server" MaxLength="10"></asp:TextBox>
                            &nbsp;<br />
                            主页：<asp:TextBox ID="txt_HomePageUpdate" runat="server" MaxLength="50"></asp:TextBox>
                            <br />
                            是否公共属性：<asp:RadioButtonList ID="drp_PublicUpdate" runat="server" RepeatDirection="Horizontal">
                                <asp:ListItem Value="true">是</asp:ListItem>
                                <asp:ListItem Value="false">不是</asp:ListItem>
                            </asp:RadioButtonList>
                            <br />
                            <asp:Button ID="btn_DUpdateSubmit" runat="server" OnClick="btn_DUpdateSubmit_Click"
                                Text="更新" CssClass="Button" />
                            &nbsp;<asp:Button ID="btn_UpdateCancel" runat="server" OnClick="btn_Cancel_Click"
                                Text="取消" CssClass="Button" />
                            <br />
                            <asp:Label ID="lbl_EditError" runat="server" EnableViewState="False" ForeColor="Red"></asp:Label>
                        </div>
                    </div>
                </asp:Panel>
                <asp:Panel ID="PanelAddRemoveUser" runat="server">
                    <div class="Dialog">
                        <div class="Title">
                            添加/移除用户</div>
                        <div class="Content">
                            当前用户组：<asp:Label ID="lbl_GroupName" runat="server" Font-Bold="True"></asp:Label>
                            <br />
                            <asp:DropDownList ID="drp_KeyWordKind" runat="server">
                                <asp:ListItem Selected="True" Value="UserName">用户名</asp:ListItem>
                                <asp:ListItem Value="Email">电子邮件</asp:ListItem>
                            </asp:DropDownList>
                            <asp:TextBox ID="txt_KeyWord" runat="server" MaxLength="100" 
                                EnableViewState="False"></asp:TextBox>
                            <br />
                            <asp:Button ID="btn_SearchUser" runat="server" CssClass="Button" 
                                onclick="btn_SearchUser_Click" Text="查找用户" />
                            <br />
                            <asp:RadioButtonList ID="drp_UserList" runat="server">
                            </asp:RadioButtonList>
                            <asp:Button ID="btn_AddRemoveUser" runat="server" CssClass="Button" 
                                OnClick="btn_GroupAddUser_Click" Text="加入该组" />
                            &nbsp;<asp:Button ID="Button2" runat="server" OnClick="btn_Cancel_Click"
                                Text="取消" CssClass="Button" />
                            <br />
                            <asp:Label ID="lbl_AddRemoveError" runat="server" EnableViewState="False" 
                                ForeColor="Red"></asp:Label>
                        </div>
                    </div>
                </asp:Panel>
            </td>
        </tr>
    </table>
</asp:Content>
